package com.gooluke.gateway.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 白名单接口配置
 */
@Configuration
@ConfigurationProperties(prefix = "spring.cloud.gateway.auth-url")
public class AuthWhitelistConfig {

    private Map<String, List<String>> whiteList;


    // Getter 和 Setter
    public List<String> getWhitelist() {
        ArrayList<String> list = new ArrayList<>();
        whiteList.forEach((k, v) -> list.addAll(v));
        return list;
    }

    public void setWhitelist(Map<String, List<String>> whiteList) {
        this.whiteList = whiteList;
    }
}